package com.miao.seckill;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@Slf4j
@RestController
public class SecKillApplication {

    public static void main(String[] args) throws Exception {
        ApplicationContext context = SpringApplication.run(SecKillApplication.class, args);
        Environment env = context.getEnvironment();
        //服务名称
        String appName = env.getProperty("spring.application.name");
        //端口号
        String port = env.getProperty("server.port");
        //服务对外ip地址
        String ip = InetAddress.getLocalHost().getHostAddress();
        log.info("项目启动成功: {} {} {}", appName, ip, port);
    }

}
